{% extends base.html %}

{% block body_left %}

{% include system/component/system_css.html %}

{% init total = "-1" %}
{% init run_time = "-1" %}
{% init rest_time = "-1" %}
{% init progress = "0.0" %}

{% include system/component/db_nav.html %}

<div class="card">
    <div class="settings-row btn-line-height">
        <div class="settings-key">备份数据库</div>
        <div class="settings-value">
            <a class="btn btn-default backup-btn">备份</a>
        </div>
    </div>

    <div class="settings-row btn-line-height">
        <div class="settings-key">备份目录</div>
        <div class="settings-value">
            <a class="btn btn-default" href="{{_server_home}}/fs_link/backup/db">进入</a>
        </div>
    </div>

    <div class="settings-row btn-line-height">
        <div class="settings-key">数据总量</div>
        <div class="settings-value">
            <span>{{total}}</span>
        </div>
    </div>

    <div class="settings-row btn-line-height">
        <div class="settings-key">备份进度</div>
        <div class="settings-value">
            <span>{{progress}}</span>
        </div>
    </div>

    <div class="settings-row btn-line-height">
        <div class="settings-key">运行时间</div>
        <div class="settings-value">
            <span>{{run_time}}</span>
        </div>
    </div>

    <div class="settings-row btn-line-height">
        <div class="settings-key">剩余时间</div>
        <div class="settings-value">
            <span>{{rest_time}}</span>
        </div>
    </div>
</div>

<script type="text/javascript">
$(function () {
    $(".backup-btn").click(function () {
        xnote.confirm("确认执行备份吗?", function (yes) {
            $.get("{{_server_home}}/system/backup?p=db");
            xnote.alert("执行中... <a target=\"_blank\" href=\"{{_server_home}}/system/log?log_type=mem&log_name=backup_db\">查看执行日志</a>");
        })
    });
})
</script>
{% end %}

{% block body_right %}
    {% include system/component/admin_nav.html %}
{% end %}